using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class tbs_Batch_DB_CRMap : EntityTypeConfiguration<tbs_Batch_DB_CR>
    {
        public tbs_Batch_DB_CRMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Origin, t.sumfields, t.dimfields });

            // Properties
            this.Property(t => t.batch)
                .HasMaxLength(8);

            this.Property(t => t.Origin)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(2);

            this.Property(t => t.sumfields)
                .IsRequired()
                .HasMaxLength(84);

            this.Property(t => t.dimfields)
                .IsRequired()
                .HasMaxLength(7);

            // Table & Column Mappings
            this.ToTable("tbs_Batch_DB_CR");
            this.Property(t => t.batch).HasColumnName("batch");
            this.Property(t => t.Origin).HasColumnName("Origin");
            this.Property(t => t.DEBIT_base_1).HasColumnName("DEBIT_base_1");
            this.Property(t => t.credit_base_1).HasColumnName("credit_base_1");
            this.Property(t => t.DEBIT_base_2).HasColumnName("DEBIT_base_2");
            this.Property(t => t.credit_base_2).HasColumnName("credit_base_2");
            this.Property(t => t.Debit_account).HasColumnName("Debit_account");
            this.Property(t => t.Credit_account).HasColumnName("Credit_account");
            this.Property(t => t.sumfields).HasColumnName("sumfields");
            this.Property(t => t.dimfields).HasColumnName("dimfields");
        }
    }
}
